package com.example8.multi_datasource_mybatisplus.controller;

import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.example8.multi_datasource_mybatisplus.entity.source.User;
import com.example8.multi_datasource_mybatisplus.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description
 * @Author lihw
 * @Date 2024/3/28 13:14
 */
@RestController
@RequestMapping("/test")
public class TestController {

    final UserService userService;

    public TestController(UserService userService) {
        this.userService = userService;
    }
    @DSTransactional
    @GetMapping("user")
    public List<User> getUserList(){
        return userService.getUserList();
    }
}
